package villa.tools.mq.views;

import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Display;

import com.ibm.mq.MQMessage;


public class GetHilo extends Thread
{
	
	private class GetHiloThread implements Runnable {
		
		private TabControlsO tco = null;
		private TabControlsH tch = null;
		private Mensaje org = null;
		
		public GetHiloThread(TabControlsO atco, TabControlsH atch, Mensaje tx) {
			tco = atco;
			tch = atch;
			org = tx;
		}
		
		public void run() {
			   try {
				   tco.msgGet = org;
				   Actions.printMessage(tco, tch);
					
			   }catch (Exception e) {
				   System.out.println("FALLO FALLO");
				   
			   }
		}
	}
	
	private TabControlsO tco1 = null;
	private TabControlsH tch1 = null;
	private Mensaje msg = null;
	
	public GetHilo(TabControlsO tco, TabControlsH tch) {
		
		msg = (Mensaje) tco.msgGet.clone();
		tco1 = tco;
		tch1 = tch;
	}
	
	public void run() {
		msg.setErr("");
		try {
			Actions.MQGet(msg);
		}catch (Exception e) {
			msg.setErr(e.toString());
		}
		Runnable GetHiloThread = new GetHiloThread(tco1, tch1, msg);
		Display.getDefault().asyncExec(GetHiloThread);
	}

};
